class CreateTaxa < ActiveRecord::Migration
  def self.up
    create_table :taxa do |t|
      t.column :name, :string
    end
    add_column :data_objects, :taxon_id, :integer
    
    execute "alter table data_objects add constraint fk_data_object_taxa foreign key (taxon_id) references taxa(id)"
  end

  def self.down
    execute "alter table data_objects drop foreign key fk_data_object_taxa"
    
    remove_column :data_objects, :taxon_id
    drop_table :taxa
  end
end
